import { createBrowserRouter } from 'react-router-dom'
import { lazy } from 'react'
const Layout = lazy(() => import('../pages/layout'))
const Login = lazy(() => import('../pages/login'))
const Home = lazy(() => import('../pages/Home'))
const Car = lazy(() => import('../pages/car'))
const Message = lazy(() => import('../pages/message'))
const My = lazy(() => import('../pages/my'))

export const childrenRouter = [
    {
        path: '/index/home',
        element: <Home />,
    },
    {
        path: '/index/car',
        element: <Car />
    },
    {
        path: '/index/message',
        element: <Message />
    },
    {
        path: '/index/my',
        element: <My />
    },
]

const routers = createBrowserRouter([
    {
        path: '/index',
        element: <Layout />,
        children: childrenRouter
    },
    {
        path: '/login',
        element: <Login />
    },

])
export default routers
